<template>

	<view>
		<view style="width: 750rpx;height: 668rpx;position: relative">
			<image src="/static/misbg.png" style="width: 750rpx;height: 668rpx;"></image>
			<view
				style="text-align: center; width: 332rpx;height: 320rpx;position: absolute;top:50%;left: 50%;transform: translate(-50%,-50%);">
				<view style="position: relative;">
					<image src="../../static/miscircle.png" style="width: 332rpx;height: 276rpx;"></image>
					<view
						style="position: absolute;top:50%;left: 50%;transform: translate(-50%,-50%);font-weight: bold;color: #fff;font-size: 60rpx;">
						{{count}}
					</view>
				</view>


				<view style="color: #fff;font-size: 40rpx;">错题库</view>
			</view>

		</view>


		<view style="margin:40rpx auto;width: 700rpx;display: flex;">
			<u-button shape="circle" @click="look(0)"
				:custom-style="{color:'#fff', background:'linear-gradient(180deg, #3CB4FE, #328DFB)'}">
				错题重做</u-button>

			<u-button shape="circle" @click="look(1)"
				:custom-style="{color:'#fff', background:'linear-gradient(180deg, #3CB4FE, #328DFB)'}">
				错题查看</u-button>
		</view>
		<view style="margin:100rpx auto;width: 500rpx;">
			<u-button shape="circle" @click="clear"
				:custom-style="{color:'#fff',background:'linear-gradient(180deg, #FFA067, #FF7254)'}">
				清空错题</u-button>
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				count: 0
			}
		},
		onLoad() {
			this.jiazai()
		},
		methods: {
			jiazai() {
				this.$u.post('/user/questionStatistics', {}).then(res => {
					this.count = res.mistakeQuestion
				}).catch(err => {

				})
			},
			look(e) {
				if(!this.count){
					this.$u.toast('暂无错题')
				}else{
					this.$u.route({
						url: '/pages/case/index',
						params: {
							type: e  ? '错题查看' : '错题重做'
						}
					})
				}
 				

			},
			clear(){
				this.$u.post('/user/clearLog', ).then(res => {
					this.jiazai()
				}).catch(err => {
				   
				})
				
			}
		}
	}
</script>

<style>
</style>
